# docker config
配置管理
# 1 配置命令汇总
- docker config create
- docker config inspect
- docker config ls
- docker config rm
# 2. 配置命令详解
# 2.1 docker config create
格式
# 根据文件或标准输入创建一个配置 #docker config create [OPTIONS] CONFIG file|- echo "this my config" |docker config create my_config - docker config create my_config2 ./config/json docker config create \ -l env=dev \ -l rev=20210111 \ my_config3 ./config.json
选项
-l, --label
配置label--template-driver
模板驱动
# 2.2 docker config inspect
格式
# 显示一个或多个配置的详细信息 # docker config inspect [OPTIONS] CONFIG [CONFIG...] docker config inspect my_config docker config inspect my_config2 my_config3 docker config inspect --pretty my_config
选项
-f,--format
格式化输出--pretty
以人类友好格式打印信息
# 2.3 docker config ls
格式
# docker config ls [OPTIONS] docker config ls #filter support id|label|name docker config ls -f "id=qtdijnf63t19r5u3yxmfki6f7" docker config ls -f label=key1 docker config ls -f label=key1=val1 docker config ls --filter "name=my_config" # format placeholder .ID|.Name|.CreatedAt|.UpdateAt|.Labels|.Label docker config ls --format "{{.ID}}: {{.Name}}" docker config ls --format "table {{.ID}}\t{{.Name}}\t{.CreatedAt}\t{{.UpdatedAt}}"
选项
-f,--filter
过滤输出format
格式化输出-q,--quiet
只显示IDs
# 2.4 docker config rm
格式
# 删除一个或多个配置(注意:没有选项,直接删除) # docker config rm CONFIG [CONFIG...]